const fs = require("fs");
const path = require("path");
const { log } = require("../util");
const { app } = require("electron");

fs.readdir(path.resolve(__dirname), (error, files) => {
  if (error) {
    log.error("uncaughtException：" + error.stack || JSON.stringify(error));
    app.exit();
    return;
  }
  files.forEach((file) => {
    const filePath = path.resolve(__dirname, file);
    if (__filename !== filePath) {
      require(filePath);
    }
  });
});
